﻿<UserControl x:Class="Plugins.UserControls.StockSelector"

             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             
             xmlns:Converters="clr-namespace:Utils.Wpf.Converters;assembly=Utils"
             xmlns:UserControls="clr-namespace:Plugins.UserControls" 
			 
			 Background="#1F1F1F"
             
             mc:Ignorable="d"
             
             d:DesignHeight="130" 
             d:DataContext="{d:DesignInstance Type=UserControls:StockSelectorVM}" >
    
    <UserControl.Resources>
        <ResourceDictionary>
            <Converters:MultiplierConverter x:Key="MultiplierConverter" />
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\PluginTheme.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>    
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

		<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Text="Stock Selection" HorizontalAlignment="Center" x:Name="Header" Margin="6" />

        <ComboBox Grid.Row="2" Grid.Column="0" Width="{Binding ActualWidth, ElementName=Header, Converter={StaticResource MultiplierConverter}, ConverterParameter=1.6}" ItemsSource="{Binding StockNames}" SelectedItem="{Binding SelectedStockName, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, NotifyOnValidationError=True, Mode=TwoWay}" PreviewMouseDown="ComboBox_PreviewMouseDown">
            <ComboBox.ToolTip>
                <StackPanel>
                    <TextBlock Foreground="Black" FontWeight="Bold" Text="Selected Stock" />
                    <TextBlock Foreground="Black" Text="The commodity to be used by the engine to execute the strategy." />
                </StackPanel>
            </ComboBox.ToolTip>
        </ComboBox>
    </Grid>
</UserControl>
